from django.db import models
from microblog.backend.models import Member

# Create your models here.
#class Person(models.Model):
 #   Name = models.CharField(max_length=20)
  #  Sex = models.CharField(max_length=10)
   # Grade = models.CharField(max_length=10)
    #SchoolNum = models.CharField(max_length=10)
    #HomeTown = models.CharField(max_length=10)
    #BirthDay = models.DateField()
    #Tel = models.CharField(max_length=15)
    #QQ = models.CharField(max_length=15)
    #Email = models.EmailField()
    #JoinTime = models.DateField()
    #State = models.CharField(max_length=20)
    #Others = models.TextField()
    
    #def __unicode__(self):
    #        return "%s, %s" % (self.Name, self.State)

class Project(models.Model):
    Name = models.CharField(max_length=20)
    Vender = models.CharField(max_length=20)
    PlatForm = models.CharField(max_length=20)
    State = models.CharField(max_length=10)
    
    def __unicode__(self):
        return "%s, %s" % (self.Name, self.State)
    
class Work(models.Model):
    Name = models.CharField(max_length=20)
    Achievement = models.CharField(max_length=10)
    Leader = models.CharField(max_length=20)
    Project = models.ForeignKey(Project)
    Leader = models.ForeignKey(Member)
    StartDate = models.DateField()
    EndDate = models.DateField()
    State = models.CharField(max_length=10)
    
    def __unicode__(self):
        return "%s, %s" % (self.Name, self.State)
    
class Plan(models.Model):
    StartDate = models.DateField()
    EndDate = models.DateField()
    Workday = models.CharField(max_length=10)
    Details = models.TextField()
    Work = models.ForeignKey(Work)
    
    def __unicode__(self):
        return "%s, %s" % (self.Work.Name, self.StartDate)
    
class Person_Work(models.Model):
    Person = models.ForeignKey(Member)
    Work = models.ForeignKey(Work)
    StartDate = models.DateField()
    EndDate = models.DateField()
    State = models.CharField(max_length=10)
    
    def __unicode__(self):
        return "%s, %s" % (self.Person.Name, self.Work.Name)

class Self_Plan(models.Model):
    StartDate = models.DateField()
    EndDate = models.DateField()
    Workday = models.CharField(max_length=10)
    Details = models.TextField()
    Person_Work = models.ForeignKey(Person_Work)
    
    def __unicode__(self):
        return "%s, %s" % (self.Person_Work.Person.Name, self.Person_Work.Work.Name)

class Task(models.Model):
    Name = models.CharField(max_length=10)
    Target = models.CharField(max_length=30)
    Detail = models.CharField(max_length=50)
    Achievement = models.CharField(max_length=10)
    StartDate = models.DateField()
    EndDate = models.DateField()
    Gravity = models.CharField(max_length=10)
    Next_Task = models.CharField(max_length=20)
    State = models.CharField(max_length=10)
    Others = models.TextField()
    Person_Work = models.ForeignKey(Person_Work)
    
    def __unicode__(self):
        return "%s, %s" % (self.Name, self.Detail)
